<%-- 
    Document   : w_product
    Created on : Sep 22, 2013, 3:11:55 PM
    Author     : Trang
--%>

<%@page import="model.Role"%>
<%@page import="model.Staff"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html>
<%
    Staff staff = (Staff) session.getAttribute("staff");

    if (staff == null) {
        response.sendRedirect(request.getContextPath() + "/Administration");
    } else {
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Receipt Management</title>
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        <link href="<%= request.getContextPath()%>/css/style_for_page.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/style_for_warehousing.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/style_for_menu.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/style_addtion.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/adMenu.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/tHeaderFooter.css" rel="stylesheet" type="text/css"/>

    </head>
    <body style="background-color: lightsteelblue;">
        <% int i = 0;%>
        <script>
            function myFunction()
            {
                var x;
                var r = confirm("You cannot delete this receipt.");
                if (r == true)
                {
                    ("input");
                }
            }
        </script>

        <div class="headerbg">
            <div class="header"> 
                <%@include file="/include/mHeader.jsp" %>
            </div>
            <div class="adContent">
                <div class="adMenu">
                    <%@include file="/include/mMenu.jsp" %>
                </div>
            </div>
        </div>
        <div class="contentbg">
            <div class="content">
                <div style="width: 1024px; color: white; background-color: #610B0B; float:left;margin:auto;">
                    <h3 style="margin-left: 10px;">Receipt Information</h3>
                </div>
                <div id="errorMessage" style="border-bottom: 1px #610B0B dashed; ">    
                    <div id="sl12">
                        <s:url namespace="/Administration/Receipt"  action="add-receipt" var="addReceiptUrl"></s:url>
                        <s:a href="%{addReceiptUrl}"  title="Add Receipt">
                            <img src="<%= request.getContextPath()%>/css/create.png" alt="Add Receipt" title="Add Receipt" style="height: 40px; width: 40px;"/>
                        </s:a>

                    </div>
                </div>         
                <div class="content2" style="margin-top: 5px;">
                    <div class="datagrid2">
                        <table>
                            <thead>
                                <tr>
                                    <th> No </th> 
                                    <th>Total Quantity</th>
                                    <th>Total Amount</th>
                                    <th>Create Date</th>
                                    <th>Supplier</th>
                                    <th>Staff</th>
                                    <th></th>
                                </tr>
                            </thead>  
                            <tbody>

                            <form name="fom" method="post"> 

                                <s:iterator value="receips">
                                    <% i++;%>
                                    <tr>
                                        <td><%out.print(i);%></td>
                                        <td><s:property value="totalQuantity"/></td>
                                        <td><s:property value="getText('{0,number,#,##0.00}',{totalAmount})"/></td>

                                        <td><s:property value="createTime"/></td>      
                                        <td><s:property value="supplier.name"/></td>

                                        <td><s:property value="staff.firstname +' '+ staff.lastname"/></td>
                                        <td>
                                            <a href="<%= request.getContextPath()%>/Administration/Receipt/delete-receipt/<s:property value='idReceipt'/>" title="<s:property value='createDate'/>">
                                                <img src="<%= request.getContextPath()%>/image/Delete.gif" alt="delete receipt" width="20" height="auto" title="Delete Receipt"/>  
                                        </td>                
                                    </tr>       
                                </s:iterator>
                            </form>
                            </tbody>
                        </table>
                    </div> 
                </div>
            </div>
        </div>
        <footer>
            <div id="footer">
                <%@include file="/include/iFooter.jsp" %>
            </div>    
        </footer>
    </body>
</html>
<%
    }
%>